package com.example.democlient.network.handler;
import com.example.democlient.network.ServerConnection.State;
import com.example.democlient.network.clientpackets.CM_ADDRESS_CREATE_RESPONSE;
import com.example.democlient.network.clientpackets.CM_ADDRESS_QUERY_RESPONSE;
import com.example.democlient.network.clientpackets.CM_ROAD_DESIGN_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_ADDRESS_UPDATE_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_CREATE_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_DELETE_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_FINISH_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_PAUSE_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_QUERY_RDFINISH_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_QUERY_RD_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_QUERY_RESPONSE;
import com.example.democlient.network.clientpackets.CM_TASK_UPDATE_RESPONSE;
import com.example.democlient.network.clientpackets.CM_USER_AUTH_RESPONSE;
import com.example.democlient.network.clientpackets.CM_USER_REGISTER_RESPONSE;
import com.example.democlient.network.clientpackets.HEARTBEAT_RESPONSE;
import com.example.democlient.network.packet.ClientPacket;

public class PacketHandlerFactory
{
	private PacketHandler	handler	= new PacketHandler();

	/**
	 * @param injector
	 */
	public PacketHandlerFactory()
	{
		addPacket(new CM_USER_AUTH_RESPONSE(0x02), State.CONNECTED);
		addPacket(new CM_USER_REGISTER_RESPONSE(0x01), State.CONNECTED);
		addPacket(new HEARTBEAT_RESPONSE(0xef), State.CONNECTED);
		addPacket(new CM_TASK_QUERY_RESPONSE(0x03), State.CONNECTED);
		addPacket(new CM_TASK_CREATE_RESPONSE(0x04), State.CONNECTED);
		addPacket(new CM_ADDRESS_CREATE_RESPONSE(0x05), State.CONNECTED);
		addPacket(new CM_TASK_FINISH_RESPONSE(0x06), State.CONNECTED);
		addPacket(new CM_TASK_PAUSE_RESPONSE(0x07), State.CONNECTED);
		addPacket(new CM_TASK_DELETE_RESPONSE(0x08), State.CONNECTED);
		addPacket(new CM_TASK_DELETE_RESPONSE(0x08), State.CONNECTED);
		addPacket(new CM_TASK_UPDATE_RESPONSE(0x09), State.CONNECTED);
		addPacket(new CM_TASK_ADDRESS_UPDATE_RESPONSE(0x10), State.CONNECTED);
		addPacket(new CM_ADDRESS_QUERY_RESPONSE(0x11), State.CONNECTED);
		addPacket(new CM_ROAD_DESIGN_RESPONSE(0x12), State.CONNECTED);
		addPacket(new CM_TASK_QUERY_RD_RESPONSE(0x13), State.CONNECTED);
		addPacket(new CM_TASK_QUERY_RDFINISH_RESPONSE(0x14), State.CONNECTED);
	}
	

	/**
	 * 
	 * @param prototype
	 * @param states
	 */
	private void addPacket(ClientPacket prototype, State... states)
	{
		handler.addPacketPrototype(prototype, states);
	}

	/**
	 * @return handler
	 */
	public PacketHandler getPacketHandler()
	{
		return handler;
	}
}